package controller;
//用于AJAX 目前没用
import java.io.IOException;
import java.io.PrintWriter;

import dao.WeiGuiDao;
import jakarta.servlet.ServletException;
import jakarta.servlet.annotation.WebServlet;
import jakarta.servlet.http.HttpServlet;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;

@WebServlet("/CheckStudentIDServlet")
public class CheckStudentIDServlet extends HttpServlet {
    /**
	 * 
	 */
	private static final long serialVersionUID = 1L;

	protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        // 设置响应内容类型为 JSON
        response.setContentType("application/json;charset=UTF-8");
        PrintWriter out = response.getWriter();
        
        // 获取传入的学号
        String id = request.getParameter("id");
        System.out.println("CheckStudentIDServlet传入的id："+id);
        // 使用 DAO 查询数据库中是否存在该学号
        WeiGuiDao dao = new WeiGuiDao();
        boolean usernameExists = dao.checkStudentIDExists(id);
        
       
        
        //out.print(jsonResponse.toString());
        out.flush();
    }
}
